#!/bin/sh
# - runtime
# - concurrency

. $LKP_SRC/lib/reproduce-log.sh
. $LKP_SRC/lib/apache.sh

set_apache_name

[ -n "$direct_server_ips" ] && server=$direct_server_ips
[ -z "$server" ] && server=127.0.0.1
server=${server%% *}

[ -n "$runtime" ] || runtime=300
[ -n "$concurrency" ] || concurrency=1000

# avoid apr_socket_recv: Connection reset by peer (104)
log_cmd sysctl -w net.ipv4.tcp_syncookies=0

log_cmd enable_apache_mod auth_basic authn_core authn_file authz_core authz_host authz_user access_compat

log_cmd systemctl restart "$APACHE_NAME"

# To avoid the follow error: socket: Too many open files (24)
ulimit -n 102400

log_cmd ab -k -q -t $runtime -n 1000000 -c $concurrency $server/
